<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>添加课程</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>

<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">课程名称:</label>
        <div class="layui-input-block">
            <input type="text" name="courseName" required placeholder="请输入课程名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">课程类型:</label>
        <div class="layui-input-block">
            <input type="radio" name="courseTypeId" value="1" title="面授" checked>
            <input type="radio" name="courseTypeId" value="2" title="在线">
            <input type="radio" name="courseTypeId" value="3" title="双师">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">主讲老师:</label>
        <div class="layui-input-block">
            <select name="tid">
                <!--需要从老师表中查询  格式;id name-->
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">适合对象:</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入描述" class="layui-textarea" name="fitObj"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">培养目标:</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入描述" class="layui-textarea" name="trnObj"></textarea>
        </div>
    </div>

    <!--获取市id是一个联动的状态   调用别人的-->

    <div class="layui-form-item">
        <label class="layui-form-label">复选框</label>
        <div class="layui-input-block">
            <input type="checkbox" name="like[write]" title="写作">
            <input type="checkbox" name="like[read]" title="阅读" checked>
            <input type="checkbox" name="like[dai]" title="发呆">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开关</label>
        <div class="layui-input-block">
            <input type="checkbox" name="switch" lay-skin="switch">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单选框</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男">
            <input type="radio" name="sex" value="女" title="女" checked>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">文本域</label>
        <div class="layui-input-block">
            <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>


<script src="/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form','table'], function(){
        var layer = layui.layer
            ,form = layui.form
            ,table = layui.table;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });

    });
</script>
</body>
</html>